package com.gzs.learn.springcloud.controller;

import com.gzs.learn.springcloud.dto.DateEntityDto;
import com.gzs.learn.springcloud.service.ISayHelloService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "say-hello")
@RequiredArgsConstructor
public class SayHelloController {
    private final ISayHelloService sayHelloService;

    @GetMapping(value = "/say-hello", params = {"username"})
    public String sayHello4UserName(@RequestParam("username") String username) {
        return "say hello from param username:" + username;
    }

    @GetMapping(value = "/say-hello", params = {"customerName"})
    public String sayHello4CustomerName(@RequestParam("customerName") String customerName) {
        return "say hello from param customerName:" + customerName;
    }

    @GetMapping(value = "date-entity")
    public DateEntityDto getDateEntityDto() {
        return sayHelloService.getDateEntity();
    }
}
